<template>
  <div class="app-container">
    {{kaoshi_name}}
    <el-tabs v-model="tabName" @tab-click="tabClick">
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_xueke/list'])" label="学科" name="xueke">
        <kaoshi-xueke :kaoshi_id="kaoshi_id" v-if="xueke" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_shichang/list'])" label="试场" name="shichang">
        <kaoshi-shichang :kaoshi_id="kaoshi_id" v-if="shichang" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_jiankao/getJiaokaoTable'])" label="监考" name="jiankao">
        <kaoshi-jiankao :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="jiankao" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_jiankao/getJiaokaoTable'])" label="试卷袋标签" name="jiankaoprint">
        <kaoshi-jiankao-print :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="jiankaoprint" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_kaosheng/list'])" label="考生" name="kaosheng">
        <kaoshi-kaosheng :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="kaosheng" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_kaosheng/listForBanjiPrint'])" label="各班座位表" name="kaoshengPrintByBanji">
        <kaoshi-kaosheng-print-by-banji :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="kaoshengPrintByBanji" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_kaosheng/listForShichangPrint'])" label="各试场座位表" name="kaoshiKaoshengPrintByShichang">
        <kaoshi-kaosheng-print-by-shichang :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="kaoshiKaoshengPrintByShichang" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_chengji/list'])" label="成绩" name="chengji">
          <kaoshi-chengji :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="chengji" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(['/chengji/Kaoshi_chengji/listChengjiHuizong'])" label="成绩汇总" name="huizong">
        <kaoshi-chengji-huizong :kaoshi_id="kaoshi_id" :kaoshi_name="kaoshi_name" v-if="huizong" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  import screenHeight from '@/utils/screen-height'
  import checkPermission from '@/utils/permission' // 权限判断函数
  import KaoshiXueke from './components/KaoshiXueke'
  import KaoshiShichang from './components/KaoshiShichang'
  import KaoshiJiankao from './components/KaoshiJiankao'
  import KaoshiJiankaoPrint from './components/KaoshiJiankaoPrint'
  import KaoshiKaosheng from './components/KaoshiKaosheng'
  import KaoshiKaoshengPrintByBanji from './components/KaoshiKaoshengPrintByBanji'
  import KaoshiKaoshengPrintByShichang from './components/KaoshiKaoshengPrintByShichang'
  import KaoshiChengji from './components/KaoshiChengji'
  import KaoshiChengjiHuizong from './components/KaoshiChengjiHuizong'


  export default {
    name: 'KaoshiManage',
    components: { KaoshiXueke,KaoshiShichang,KaoshiJiankao,KaoshiKaosheng,KaoshiJiankaoPrint,
      KaoshiKaoshengPrintByBanji,KaoshiKaoshengPrintByShichang,
      KaoshiChengji,KaoshiChengjiHuizong
    },
    data() {
      return {
        xueke: false,
        shichang: false,
        jiankao: false,
        jiankaoprint:false,
        kaosheng:false,
        kaoshengPrintByBanji:false,
        kaoshiKaoshengPrintByShichang:false,
        chengji:false,
        huizong:true,
        tabName: 'huizong',
        kaoshi_id: this.$route.query.id,
        kaoshi_name: this.$route.query.name
      }
    },
    created() {
      this.height = screenHeight()
    },
    methods: {
      checkPermission,
      tabClick(tab) {
        this[tab.name] = true
      }
    }
  }
</script>
